Field of the Invention
Embodiments of the present invention generally relate to a method and apparatus for simplifying error detection in Context-Adaptive Binary Arithmetic Coding.
Description of the Related Art
Decoder can detect bitstream errors in slice data by comparing the number decoded bits and the size of the current Network Abstract Layer (NAL) unit. If the numbers are mismatched, it is likely that the decoded bitstream includes errors. During slice data decoding, decoder can detect bitstream errors, which maybe result from a number of reason, such as, decoded syntax element is out of range, alignment one bit is not 1, alignment zero bit is not 0, and the likes. In many cases, bit corruptions or packet loss may cause one or more of such conditions. A decoder can detect the errors. But if the corruption of bits or packet loss accidentally forms the correct syntax elements without causing the detectable conditions, the errors may not be detected during slice data decoding.
Detecting mismatch of NAL unit size and decoded bits is usually a strong tool for the error detection. Even if the corruption of bits or packet loss accidentally forms the correct syntax element, the error can be detected when the decoded number of bits does not match the size of NAL unit. In this contribution, this method is called detection of NAL unit size mismatch.
The detection of Network Abstract Layer unit size mismatch can be easily implemented in the case of Context-adaptive variable-length coding (CAVLC). But it is difficult to implement it in the case of Context-Adaptive Binary Arithmetic Coding. This is due to the existence of cabac_zero_word in Context-Adaptive Binary Arithmetic Coding syntax. The next section explains how the detection is implemented in Advanced Video coding (AVC).
rbsp_slice_trailing_bits( ) {rbsp_trailing_bits( )if( entropy_coding_mode_flag )while( more_rbsp_trailing_data( ) )cabac_zero_word /* equal to 0x0000 */}
In AVC, encoder can change the size of NAL unit by inserting arbitrary numbers of cabac_zero_word in the case of CABAC. For decoder, decoder cannot judge whether the next “0x000003” is really cabac_zero_word plus EPB (Emulation Prevention Byte, 0x03) or not just by looking into the next 24bits from the end of rbsp_trailing_bits( )since “0x000003” can be existed in macroblock_layer( ), where RBSP stand for Raw Byte Sequence Payload.
In order to confirm the next 24 bits equal to “0x000003” is really cabac_zero_word plus EPB, decoder should read all the data from the end of rbsp_trailing_bits( )to the end of Network Abstract Layer unit. If all the data are composed of cabac_zero_word plus EPBs, decoder can say the next 24 bits from the end of rbsp_trailing_bits( )is surely cabac_zero_word plus EPBs. After detecting the starting position of arbitrary numbers of cabac_zero_word, decoder can know the size of Network Abstract Layer unit, and can use it for error detection. But it is too cycle consuming tasks for hardware or software to read all the data from the rbsp_trailing_bits( )to the end of Network Abstract Layer unit to confirm the cabac_zero_word.
Therefore, there is a need for a method and/or apparatus for detecting error in CABAC.